using UnityEngine;
using UnityEngine.SceneManagement;

public class SceneHelper
{
    private static void onSceneLoaded(Scene sc, LoadSceneMode loadSceneMode)
    {
        SceneManager.sceneLoaded -= onSceneLoaded;
        SceneManager.SetActiveScene(sc);
    }

    public static void LoadScene(string name, LoadSceneMode loadSceneMode = LoadSceneMode.Single)
    {
        SceneManager.LoadScene(name, loadSceneMode);
        var scene = SceneManager.GetSceneByName(name);
        Debug.Log(scene.name);
        SceneManager.sceneLoaded += onSceneLoaded;
    }
}